<template>
  <div>
    <news-swiper :list="swiperList"></news-swiper>
    <news-item :list="itemList"></news-item>
  </div>
</template>

<script>
import NewsSwiper from './components/Swiper'
import NewsItem from './components/Item'
import {getHomeInfo} from 'api/complex'
export default {
  name: 'News',
  components: {
    NewsSwiper,
    NewsItem
  },
  data () {
    return {
      swiperList: [],
      itemList: []
    }
  },
  methods: {
    _getHomeInfo () {
      getHomeInfo().then(this.getHomeInfoSucc)
    },
    getHomeInfoSucc (res) {
      res = res.data
      if (res.ret && res.data) {
        const data = res.data
        this.swiperList = data.swiperList
        this.itemList = data.newsItemList
      }
    }
  },
  mounted () {
    this._getHomeInfo()
  }
}
</script>

<style lang="stylus" scoped>

</style>
